package xj.meta;

import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

public class ModelRelation extends AbstractElement {

  public ModelRelation(String name) {
    this.name = name;
    set = new HashSet<AssociationElement>();
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public void add(AssociationElement assoc) {
    if (assoc != null) {
      set.add(assoc);
    }
  }

  public void add(ModelElement x, ModelElement y) {
    if (x != null && y != null) {
      set.add(new AssociationElement(x, y));
    }
  }

  public Iterator<AssociationElement> iterator() {
    return set.iterator();
  }

  protected String name;

  protected Set<AssociationElement> set;

}
